Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repl: eval empty lines, fixing debugger repeat #6025

Closed
wants to merge 4 commits into from

Conversation

lrowe
Copy link

@lrowe lrowe commented Apr 3, 2016

Pull Request check-list

Please make sure to review and check all of these items:

  • Does make -j8 test (UNIX) or vcbuild test nosign (Windows) pass with
    this change (including linting)?
  • Is the commit message formatted according to CONTRIBUTING.md?
  • If this change fixes a bug (or a performance problem), is a regression
    test (or a benchmark) included?
  • Is a documentation update included (if this change modifies
    existing APIs, or introduces new ones)?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Affected core subsystem(s)

repl, debugger

Description of change

Tweak the better empty line handling introduced in #2163 so that empty lines
are still passed to the eval function. This is required for the debugger to
repeat the last command on an empty line.

Fixes: #6010

@lrowe
Copy link
Author

lrowe commented Apr 3, 2016

All tests pass other than parallel/test-tick-processor which was failing on master on my machine.

Debugger repetition is tested in https://github.com/nodejs/node/blob/master/test/debugger/test-debugger-repl-term.js#L18-L23. I'm not sure how that is passing while a manual test fails. However the debugger tests are not run by default.

With this fix the debugger tests no longer timeout, but there are multiple failures, presumably they have not been kept up to date.

@bnoordhuis
Copy link
Member

Yes, the debugger tests aren't run regularly; they're pretty flaky due to the nature of the debugger.

I don't think this change is acceptable as-is because it changes all REPL behavior, not just the debugger's. The fix should probably be somewhere in lib/_debugger.js.

If you can get test/debugger/test-debugger-repl-term.js to work reliably, please move it over to test/parallel - they're run regularly.

@ChALkeR ChALkeR added the repl Issues and PRs related to the REPL subsystem. label Apr 3, 2016
@lrowe
Copy link
Author

lrowe commented Apr 3, 2016

This behaviour of the REPL with it's defaultEval should be unchanged. In order to prevent "undefined from printing if the string is empty", b54f153 avoids calling eval. With this patch eval is called but an undefined result for an empty string is not printed.

I don't think it's possible to fix this from within the debugger since the REPLServers's on('line', ... event listener no longer calls the eval function (which the debugger provides) for empty lines. It's not possible for the debugger to override the on('line', ... event listener since it is a closure within REPLServer which sets variables declared in the REPLServer scope.

I'll have a go at fixing the debugger tests. I wonder if the reliability problems were due to running multiple debugger tests in parallel when they all use the same port.

Tweak the better empty line handling introduced in nodejs#2163 so that empty
lines are still passed to the eval function. This is required for the
debugger to repeat the last command on an empty line.

Fixes: nodejs#6010
Matches current behaviour of Chrome devtools.

PR-URL: nodejs#6025
Line numbers changed following comments cleanup in 3e1b1dd.

PR-URL: nodejs#6025
Expected line now includes a prefix.

PR-URL: nodejs#6025
@lrowe
Copy link
Author

lrowe commented Apr 4, 2016

The debugger tests all pass now. I need to work out how to run them in parallel to check reliability - I expect failures due to multiple tests using the same port.

@Trott
Copy link
Member

Trott commented May 26, 2016

I believe the issue this is addressing has been fixed in 1df84f4. The issue should be resolved in Node.js 6.0.0 and newer. I'm going to close this, but If I'm mistaken/misunderstanding, please re-open.

@Trott Trott closed this May 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

node debug does not repeat last command when hitting enter at prompt
4 participants